
using System.Data;
using log4net.Appender;
using log4net.Layout;

namespace Sedna.TestClasses
{
	/// <summary>
	/// Customized log4net ADONetAppender for logging into Sedna DB LOG table.
	/// </summary>
	public class SednaDbAppender{ /* : ADONetAppender
	{
		public SednaDbAppender() : base()
		{
			BufferSize = 1;
			ConnectionType = "System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=B77A5C561934E089";
			//ConnectionString = null;//LCore.SqlConnectionString;
			ConnectionString = System.Configuration.ConfigurationSettings.AppSettings.Get("connection.string");
			CommandType = System.Data.CommandType.StoredProcedure;
			CommandText = "AUTO_LOG_INS";
			UseTransactions = false;

			PatternLayout patternLt = null;
			ExceptionLayout excLt = null;

			// stub parameter for ID, OUTPUT
			ADONetAppenderParameter param = new ADONetAppenderParameter();
			param.ParameterName = "@ID";
			param.DbType = DbType.Int32;
			patternLt = new PatternLayout("7");
			param.Layout = new Layout2RawLayoutAdapter(patternLt);
			AddParameter(param);

			// stub parameter for RC, OUTPUT
			param = new ADONetAppenderParameter();
			param.ParameterName = "@RC";
			param.DbType = DbType.Int32;
			patternLt = new PatternLayout("77");
			param.Layout = new Layout2RawLayoutAdapter(patternLt);
			AddParameter(param);

			// entry date and time
			param = new ADONetAppenderParameter();
			param.ParameterName = "@DTP";
			param.DbType = DbType.DateTime;
			param.Layout = new RawTimeStampLayout();
			AddParameter(param);

			// source thread number or name
			param = new ADONetAppenderParameter();
			param.ParameterName = "@TNN";
			param.DbType = DbType.String;
			param.Size = 100;
			patternLt = new PatternLayout("%t");
			param.Layout = new Layout2RawLayoutAdapter(patternLt);
			AddParameter(param);

			// severity level
			param = new ADONetAppenderParameter();
			param.ParameterName = "@SEVERITY";
			param.DbType = DbType.String;
			param.Size = 5;
			patternLt = new PatternLayout("%-5p");
			param.Layout = new Layout2RawLayoutAdapter(patternLt);
			AddParameter(param);

			// class FQN
			param = new ADONetAppenderParameter();
			param.ParameterName = "@BY_CLASS";
			param.DbType = DbType.String;
			param.Size = 2000;
			patternLt = new PatternLayout("%C");
			param.Layout = new Layout2RawLayoutAdapter(patternLt);
			AddParameter(param);

			// class FQN
			param = new ADONetAppenderParameter();
			param.ParameterName = "@BY_METHOD";
			param.DbType = DbType.String;
			param.Size = 1800;
			patternLt = new PatternLayout("%M");
			param.Layout = new Layout2RawLayoutAdapter(patternLt);
			AddParameter(param);

			// messages string
			param = new ADONetAppenderParameter();
			param.ParameterName = "@MESSAGES";
			param.DbType = DbType.String;
			param.Size = 1073741823;
			patternLt = new PatternLayout("%m");
			param.Layout = new Layout2RawLayoutAdapter(patternLt);
			AddParameter(param);

			// exception data string
			param = new ADONetAppenderParameter();
			param.ParameterName = "@EXCEPTION";
			param.DbType = DbType.String;
			param.Size = 1073741823;
			excLt = new ExceptionLayout();
			param.Layout = new Layout2RawLayoutAdapter(excLt);
			AddParameter(param);
		}*/
	}
}